package com.kakaxi.mybilibili.module.home.find.model;

import com.alibaba.fastjson.JSONObject;
import com.kakaxi.mybilibili.common.WebUrlConst;
import com.kakaxi.mybilibili.net.FastJsonCacheRequest;
import com.kakaxi.mybilibili.net.Netroid;
import com.vincestyling.netroid.Listener;

/**
 * 排行榜数据层实现类
 * Created by kakaxi on 16/11/25.
 */

public class FindRankModel implements IFindRankModel {

    /** 全区排行榜 **/
    public static final int TYPE_RANK_ALL = 1;
    /** 原创排行榜 **/
    public static final int TYPE_RANK_NEW = 2;

    /** 原创 **/
    public static final int TYPE_TAB_NEW = 0;
    /** 全站 **/
    public static final int TYPE_TAB_NEW_ALL = 1;
    /** 番剧 **/
    public static final int TYPE_TAB_NEW_DRAMA = 2;

    @Override
    public void getRankData(int rankType, int tabType, Listener<JSONObject> listener) {
        String url = null;
        if (rankType == TYPE_RANK_ALL) {

        } else if (rankType == TYPE_RANK_NEW) {
            switch (tabType) {
                case TYPE_TAB_NEW: // 原创
                    url = WebUrlConst.FIND_RANK_NEW_URL;
                    break;
                case TYPE_TAB_NEW_ALL: // 全站
                    url = WebUrlConst.FIND_RANK_NEW_ALL_URL;
                    break;
                case TYPE_TAB_NEW_DRAMA: // 番剧
                    url = WebUrlConst.FIND_RANK_NEW_DRAMA_URL;
                    break;
            }
        }

        if (url != null) {
            Netroid.addRequest(new FastJsonCacheRequest(url, null, listener, null), true);
        }
    }
}
